from test.models import ActiveDiagnosticTest

def get_active_diagnostic_test():
    """
   Returns the diagnostic test that is currently set as active
   """
    ad = get_pointer()
    if ad is not None:
        return ad.diagnostic_test
    else:
        return None
    
    
def set_active_diagnostic_test(diagnostic_test):
    ad = get_pointer()
    ad.diagnostic_test = diagnostic_test
    ad.save()
    

def get_pointer():
    """ 
    Help method, do not use this outside utils 
    """
    try:
        ad = ActiveDiagnosticTest.objects.get(pk=1)
        return ad
    
    except ActiveDiagnosticTest.DoesNotExist:
        return None
